pkgname=kinit
pkgver=5.37.0
pkgrel=1
pkgdesc='Process launcher to speed up launching KDE applications'
arch="all"
url='https://community.kde.org/Frameworks'
license="LGPL"
depends="kio"
makedepends="extra-cmake-modules kdoctools-dev python kio-dev kservice-dev kcrash-dev kbookmarks-dev
			 kcompletion-dev kitemviews-dev kjobwidgets-dev solid-dev kxmlgui-dev kconfig-dev
			 kcoreaddons-dev kwidgetsaddons-dev kconfigwidgets-dev kauth-dev kcodecs-dev ki18n-dev
			 kwindowsystem-dev"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz
		D6598.patch"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"

prepare() {
	mkdir -p $srcdir/build

	cd "$srcdir"/$pkgname-$pkgver
	patch -p1 < ../D6598.patch
}

build() {
	cd $srcdir/build
	cmake "$srcdir"/${pkgname}-${pkgver} \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DKDE_INSTALL_LIBDIR=lib \
		-DKDE_INSTALL_LIBEXECDIR=lib \
		-DBUILD_TESTING=OFF \
		-DBUILD_QCH=ON
	make
}

package() {
	cd $srcdir/build
	make DESTDIR="${pkgdir}" install

	chmod 0644 $pkgdir/usr/lib/kf5/start_kdeinit # remove suid bit as it's disallowed by Alpine standards due to being a security risk
}
sha512sums="c12157a88eb708b5838ba381f31460f21adf190a9f1ca58f2f32824c10901f5c716a251af7a24493e0715605c6c0fc480a361bf2fd656a6f38763f0de99dc576  kinit-5.37.0.tar.xz
1a12deb6cebcedb2ee2ae5edfedc48473e7f464d5d8ba84c2130c567fb564d1f4ef87f6b0b7500104f893075348bb86f243b25e8710a286fc67828a50c44a628  D6598.patch"
